<!DOCTYPE html><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<meta charset="utf-8">
<title>phpDocumentor » \user_accounts</title>
<meta name="author" content="Mike van Riel">
<meta name="description" content="">
<link href="../css/template.css" rel="stylesheet" media="all">
<script src="../js/jquery-1.7.1.min.js" type="text/javascript"></script><script src="../js/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script><script src="../js/jquery.mousewheel.min.js" type="text/javascript"></script><script src="../js/bootstrap.js" type="text/javascript"></script><script src="../js/template.js" type="text/javascript"></script><script src="../js/prettify/prettify.min.js" type="text/javascript"></script><link rel="shortcut icon" href="../img/favicon.ico">
<link rel="apple-touch-icon" href="../img/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="../img/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="../img/apple-touch-icon-114x114.png">
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="navbar-inner"><div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></a><a class="brand" href="../index.html">phpDocumentor</a><div class="nav-collapse"><ul class="nav">
<li class="dropdown">
<a href="#api" class="dropdown-toggle" data-toggle="dropdown">
                                    API Documentation <b class="caret"></b></a><ul class="dropdown-menu">
<li><a>Packages</a></li>
<li><a href="../packages/api.html"><i class="icon-folder-open"></i> api</a></li>
<li><a href="../packages/css.html"><i class="icon-folder-open"></i> css</a></li>
<li><a href="../packages/img.html"><i class="icon-folder-open"></i> img</a></li>
<li><a href="../packages/inc.html"><i class="icon-folder-open"></i> inc</a></li>
<li><a href="../packages/js.html"><i class="icon-folder-open"></i> js</a></li>
</ul>
</li>
<li class="dropdown" id="charts-menu">
<a href="#charts" class="dropdown-toggle" data-toggle="dropdown">
                                    Charts <b class="caret"></b></a><ul class="dropdown-menu"><li><a href="../graph_class.html"><i class="icon-list-alt"></i> Class hierarchy diagram</a></li></ul>
</li>
<li class="dropdown" id="reports-menu">
<a href="#reports" class="dropdown-toggle" data-toggle="dropdown">
                                    Reports <b class="caret"></b></a><ul class="dropdown-menu">
<li><a href="../errors.html"><i class="icon-remove-sign"></i> Errors 
                <span class="label label-info">0</span></a></li>
<li><a href="../markers.html"><i class="icon-map-marker"></i> Markers 
                <ul></ul></a></li>
<li><a href="../deprecated.html"><i class="icon-stop"></i> Deprecated elements 
                <span class="label label-info">0</span></a></li>
</ul>
</li>
</ul></div>
</div></div>
<div class="go_to_top"><a href="#___" style="color: inherit">Back to top  <i class="icon-upload icon-white"></i></a></div>
</div>
<div id="___" class="container">
<noscript><div class="alert alert-warning">
                            Javascript is disabled; several features are only available
                            if Javascript is enabled.
                        </div></noscript>
<div class="row">
<div class="span4">
<span class="btn-group visibility" data-toggle="buttons-checkbox"><button class="btn public active" title="Show public elements">Public</button><button class="btn protected" title="Show protected elements">Protected</button><button class="btn private" title="Show private elements">Private</button><button class="btn inherited active" title="Show inherited elements">Inherited</button></span><div class="btn-group view pull-right" data-toggle="buttons-radio">
<button class="btn details" title="Show descriptions and method names"><i class="icon-list"></i></button><button class="btn simple" title="Show only method names"><i class="icon-align-justify"></i></button>
</div>
<ul class="side-nav nav nav-list"><li class="nav-header">
<i class="icon-custom icon-method"></i> Methods
                    <ul>
<li class="method public "><a href="#method_authenticate" title="authenticate :: Check for valid authorization."><span class="description">Check for valid authorization.</span><pre>authenticate()</pre></a></li>
<li class="method public "><a href="#method_create_user_account" title="create_user_account :: Create a user account with the given information."><span class="description">Create a user account with the given information.</span><pre>create_user_account()</pre></a></li>
<li class="method public "><a href="#method_delete_user_account_by_id" title="delete_user_account_by_id :: Delete the user array for the user with the given ID."><span class="description">Delete the user array for the user with the given ID.</span><pre>delete_user_account_by_id()</pre></a></li>
<li class="method public "><a href="#method_generate_salt" title="generate_salt :: Generate a random 16 character string for salting passwords."><span class="description">Generate a random 16 character string for salting passwords.</span><pre>generate_salt()</pre></a></li>
<li class="method public "><a href="#method_get_user_account_by_email" title="get_user_account_by_email :: Get the user array for the user with the given email, or null if none
exist."><span class="description">Get the user array for the user with the given email, or null if none
exist.</span><pre>get_user_account_by_email()</pre></a></li>
<li class="method public "><a href="#method_get_user_account_by_id" title="get_user_account_by_id :: Get the user array for the user with the given ID, or null if none exist."><span class="description">Get the user array for the user with the given ID, or null if none exist.</span><pre>get_user_account_by_id()</pre></a></li>
<li class="method public "><a href="#method_get_user_account_by_username" title="get_user_account_by_username :: Get the user array for the user with the given username, or null if none
exist."><span class="description">Get the user array for the user with the given username, or null if none
exist.</span><pre>get_user_account_by_username()</pre></a></li>
<li class="method public "><a href="#method_get_user_account_editor" title="get_user_account_editor :: Get the HTML for an editor used to create or edit the given user account
entry."><span class="description">Get the HTML for an editor used to create or edit the given user account
entry.</span><pre>get_user_account_editor()</pre></a></li>
<li class="method public "><a href="#method_get_user_account_types" title="get_user_account_types :: Get the enum types for user accounts in an array."><span class="description">Get the enum types for user accounts in an array.</span><pre>get_user_account_types()</pre></a></li>
<li class="method public "><a href="#method_get_user_accounts" title="get_user_accounts :: Get an array of all the user accounts in the system, or null if none
exist."><span class="description">Get an array of all the user accounts in the system, or null if none
exist.</span><pre>get_user_accounts()</pre></a></li>
<li class="method public "><a href="#method_update_user_account" title="update_user_account :: Update a user account with the given information inside of the array."><span class="description">Update a user account with the given information inside of the array.</span><pre>update_user_account()</pre></a></li>
<li class="method public "><a href="#method_valid_user_account_fields" title="valid_user_account_fields :: Check if the given array has all of the necessary fields to create a new
user account."><span class="description">Check if the given array has all of the necessary fields to create a new
user account.</span><pre>valid_user_account_fields()</pre></a></li>
</ul>
</li></ul>
</div>
<div class="span8">
<a id="\user_accounts"></a><ul class="breadcrumb">
<li>
<a href="../index.html"><i class="icon-custom icon-class"></i></a><span class="divider">\</span>
</li>
<li><a href="../namespaces/global.html">global</a></li>
<li class="active">
<span class="divider">\</span><a href="../classes/user_accounts.html">user_accounts</a>
</li>
</ul>
<div class="element class">
<p class="short_description">A static class to contain the user_accounts.inc.php static functions.</p>
<div class="details">
<div class="long_description"></div>
<table class="table table-bordered">
<tr>
<th>author</th>
<td><a href="mailto:rctoris@wpi.edu">Russell Toris</a></td>
</tr>
<tr>
<th>copyright</th>
<td>2013 Russell Toris, Worcester Polytechnic Institute</td>
</tr>
<tr>
<th>license</th>
<td><a href="">BSD -- see LICENSE file</a></td>
</tr>
<tr>
<th>version</th>
<td>April, 12 2013</td>
</tr>
<tr>
<th>package</th>
<td><a href="../packages/api.users.user.accounts.html">api.users.user_accounts</a></td>
</tr>
</table>
<h3>
<i class="icon-custom icon-method"></i> Methods</h3>
<a id="method_authenticate"></a><div class="element clickable method public method_authenticate" data-toggle="collapse" data-target=".method_authenticate .collapse">
<h2>Check for valid authorization.</h2>
<pre>authenticate() : array | null</pre>
<div class="labels"><span class="label">Static</span></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>If the RMS-Use-Session HTTP header is set
to true, then session information will be used for authorization. If this
is not the case, then the HTTP Authentication header is used to
authenticate.</p></div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code><code>null</code>The authenticated user or null if none exist</div>
</div></div>
</div>
<a id="method_create_user_account"></a><div class="element clickable method public method_create_user_account" data-toggle="collapse" data-target=".method_create_user_account .collapse">
<h2>Create a user account with the given information.</h2>
<pre>create_user_account(string $username, string $password, string $firstname, string $lastname, string $email, string $type) : string | null</pre>
<div class="labels"><span class="label">Static</span></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>Any errors are
returned.</p></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$username</h4>
<code>string</code><p>The username</p></div>
<div class="subelement argument">
<h4>$password</h4>
<code>string</code><p>The raw password</p></div>
<div class="subelement argument">
<h4>$firstname</h4>
<code>string</code><p>The firstname of the user</p></div>
<div class="subelement argument">
<h4>$lastname</h4>
<code>string</code><p>The lastname of the user</p></div>
<div class="subelement argument">
<h4>$email</h4>
<code>string</code><p>The email address of the user</p></div>
<div class="subelement argument">
<h4>$type</h4>
<code>string</code><p>The type of user</p></div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code><code>null</code>An error message or null if the create was sucessful</div>
</div></div>
</div>
<a id="method_delete_user_account_by_id"></a><div class="element clickable method public method_delete_user_account_by_id" data-toggle="collapse" data-target=".method_delete_user_account_by_id .collapse">
<h2>Delete the user array for the user with the given ID.</h2>
<pre>delete_user_account_by_id(integer $id) : string | null</pre>
<div class="labels"><span class="label">Static</span></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>Any errors are
returned.</p></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$id</h4>
<code>integer</code><p>The user ID number</p></div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code><code>null</code>an error message or null if the delete was sucessful</div>
</div></div>
</div>
<a id="method_generate_salt"></a><div class="element clickable method public method_generate_salt" data-toggle="collapse" data-target=".method_generate_salt .collapse">
<h2>Generate a random 16 character string for salting passwords.</h2>
<pre>generate_salt() : string</pre>
<div class="labels"><span class="label">Static</span></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>The 16 character salt</div>
</div></div>
</div>
<a id="method_get_user_account_by_email"></a><div class="element clickable method public method_get_user_account_by_email" data-toggle="collapse" data-target=".method_get_user_account_by_email .collapse">
<h2>Get the user array for the user with the given email, or null if none
exist.</h2>
<pre>get_user_account_by_email(string $email) : array | null</pre>
<div class="labels"><span class="label">Static</span></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$email</h4>
<code>string</code><p>The email</p></div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code><code>null</code>An array of the user's SQL entry or null if none exist</div>
</div></div>
</div>
<a id="method_get_user_account_by_id"></a><div class="element clickable method public method_get_user_account_by_id" data-toggle="collapse" data-target=".method_get_user_account_by_id .collapse">
<h2>Get the user array for the user with the given ID, or null if none exist.</h2>
<pre>get_user_account_by_id(integer $id) : array | null</pre>
<div class="labels"><span class="label">Static</span></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$id</h4>
<code>integer</code><p>The user ID number</p></div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code><code>null</code>An array of the user's SQL entry or null if none exist</div>
</div></div>
</div>
<a id="method_get_user_account_by_username"></a><div class="element clickable method public method_get_user_account_by_username" data-toggle="collapse" data-target=".method_get_user_account_by_username .collapse">
<h2>Get the user array for the user with the given username, or null if none
exist.</h2>
<pre>get_user_account_by_username(string $username) : array | null</pre>
<div class="labels"><span class="label">Static</span></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$username</h4>
<code>string</code><p>The username</p></div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code><code>null</code>An array of the user's SQL entry or null if none exist</div>
</div></div>
</div>
<a id="method_get_user_account_editor"></a><div class="element clickable method public method_get_user_account_editor" data-toggle="collapse" data-target=".method_get_user_account_editor .collapse">
<h2>Get the HTML for an editor used to create or edit the given user account
entry.</h2>
<pre>get_user_account_editor(integer | null $id) : string</pre>
<div class="labels"><span class="label">Static</span></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>If this is not an edit, null can be given as the ID. An invalid ID
is the same as giving a null ID.</p></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$id</h4>
<code>integer</code><code>null</code><p>the ID of the user account to edit, or null if a
    new entry is being made</p></div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code>A string containing the HTML of the editor</div>
</div></div>
</div>
<a id="method_get_user_account_types"></a><div class="element clickable method public method_get_user_account_types" data-toggle="collapse" data-target=".method_get_user_account_types .collapse">
<h2>Get the enum types for user accounts in an array.</h2>
<pre>get_user_account_types() : array</pre>
<div class="labels"><span class="label">Static</span></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code>An array containing the enum types for users</div>
</div></div>
</div>
<a id="method_get_user_accounts"></a><div class="element clickable method public method_get_user_accounts" data-toggle="collapse" data-target=".method_get_user_accounts .collapse">
<h2>Get an array of all the user accounts in the system, or null if none
exist.</h2>
<pre>get_user_accounts() : array | null</pre>
<div class="labels"><span class="label">Static</span></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Returns</h3>
<div class="subelement response">
<code>array</code><code>null</code>An array of all the user accounts in the system, or
    null if none exist</div>
</div></div>
</div>
<a id="method_update_user_account"></a><div class="element clickable method public method_update_user_account" data-toggle="collapse" data-target=".method_update_user_account .collapse">
<h2>Update a user account with the given information inside of the array.</h2>
<pre>update_user_account(array $fields) : string | null</pre>
<div class="labels"><span class="label">Static</span></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"><p>The
array should be indexed by the SQL column names. The ID field must be
contained inside of the array with the index 'id'. Any errors are
returned.</p></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$fields</h4>
<code>array</code><p>the fields to update including the user ID number</p></div>
<h3>Returns</h3>
<div class="subelement response">
<code>string</code><code>null</code>an error message or null if the update was sucessful</div>
</div></div>
</div>
<a id="method_valid_user_account_fields"></a><div class="element clickable method public method_valid_user_account_fields" data-toggle="collapse" data-target=".method_valid_user_account_fields .collapse">
<h2>Check if the given array has all of the necessary fields to create a new
user account.</h2>
<pre>valid_user_account_fields(array $array) : boolean</pre>
<div class="labels"><span class="label">Static</span></div>
<div class="row collapse"><div class="detail-description">
<div class="long_description"></div>
<h3>Parameters</h3>
<div class="subelement argument">
<h4>$array</h4>
<code>array</code><p>The array to check</p></div>
<h3>Returns</h3>
<div class="subelement response">
<code>boolean</code>If the given array has all of the necessary fields to
    create a new user account</div>
</div></div>
</div>
</div>
</div>
</div>
</div>
<div class="row"><footer class="span12">
            Template is built using <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap 2</a> and icons provided by <a href="http://glyphicons.com/">Glyphicons</a>.<br>
            Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor 2.0.0a12</a> and<br>
            generated on 2013-04-16T13:14:58-07:00.<br></footer></div>
</div>
</body>
</html>
